part of 'case_bloc.dart';

abstract class CaseState extends Equatable {
  const CaseState();

  @override
  List<Object> get props => [];
}

class CaseInitial extends CaseState {}

class CaseFailure extends CaseState {}

class CaseSuccess extends CaseState {
  final List<Post> posts;
  final bool hasReachedMax;

  const CaseSuccess({
    this.posts,
    this.hasReachedMax,
  });

  CaseSuccess copyWith({
    List<Post> posts,
    bool hasReachedMax,
  }) {
    return CaseSuccess(
      posts: posts ?? this.posts,
      hasReachedMax: hasReachedMax ?? this.hasReachedMax,
    );
  }

  @override
  List<Object> get props => [posts, hasReachedMax];

  @override
  String toString() =>
      'PostLoaded { posts: ${posts.length}, hasReachedMax: $hasReachedMax }';
}

class CaseForm extends CaseState {
  final CaseType caseType;
  final CaseContent caseContent;
  final CaseAlong caseAlong;
  final CaseAddress caseAddress;
  final List<String> caseImages;
  final FormzStatus status;

  CaseForm({
    this.status = FormzStatus.pure,
    this.caseType = const CaseType.pure(),
    this.caseContent = const CaseContent.pure(),
    this.caseAlong = const CaseAlong.pure(),
    this.caseAddress = const CaseAddress.pure(),
    this.caseImages,
  });

  CaseForm copyWith({
    FormzStatus status,
    CaseType caseType,
    CaseContent caseContent,
    CaseAlong caseAlong,
    CaseAddress caseAddress,
    List<String> caseImages,
  }) {
    return CaseForm(
      status: status ?? this.status,
      caseType: caseType ?? this.caseType,
      caseContent: caseContent ?? this.caseContent,
      caseAlong: caseAlong ?? this.caseAlong,
      caseAddress: caseAddress ?? this.caseAddress,
      caseImages: caseImages ?? this.caseImages,
    );
  }

  @override
  List<Object> get props =>
      [status, caseType, caseContent, caseAlong, caseAddress, caseImages];
}
